﻿#include <iostream>

#include <iostream>
using std::cout;
using std::endl;

#include <sstream>
using std::ostringstream;

#include <string>
using std::string;

#include "../../include/container/array.hpp"
#include "../../include/container/vector.hpp"
#include "../../include/container/list.hpp"
#include "../../include/container/deque.hpp"
#include "../../include/container/stack.hpp"
#include "../../include/algorithm/easy_dump.hpp"
#include "../../include/test/noTrivalClass.hpp"
#include "../../include/container/hashtable.hpp"
#include "../../include/container/unordered_set.hpp"

#include "../../include/container/RBtree.hpp"

//可以定位到发生内存泄露 所在的文件和具体那一行，用于检测 malloc 分配的内存
#define _CRTDBG_MAP_ALLOC 
#include <stdlib.h>
#include <crtdbg.h>

//有用
inline void EnableMemLeakCheck()
{
	//该语句在程序退出时自动调用 _CrtDumpMemoryLeaks(),用于多个退出出口的情况.
	//如果只有一个退出位置，可以在程序退出之前调用 _CrtDumpMemoryLeaks()
	_CrtSetDbgFlag(_CrtSetDbgFlag(_CRTDBG_REPORT_FLAG) | _CRTDBG_LEAK_CHECK_DF);
}

int main()
{
	EnableMemLeakCheck();
	bla::RBTree<std::string> rb1;
	rb1.size();
	rb1.insert("abc");
	rb1.insert("abdd");
	rb1.insert("aaaa");
	rb1.insert("aaaa");
	rb1.size();

	ostringstream oss;
	oss << rb1;

	rb1.remove("aaaa");
	rb1.size();
	rb1.remove("aaaa");

	oss.str("");
	oss << rb1;
}
